package com.cai.primeton.repository;

import com.cai.primeton.entity.PBorrow;
import com.cai.primeton.entity.PType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @version 1.0
 * @author：蔡松坡
 * @date：2021/7/1 16 : 29
 * @package：com.cai.primeton.repository
 */
public interface BorrowRepo extends JpaRepository<PBorrow,Integer> {

    @Modifying
    @Transactional
    @Query("update pborrow set state = :state,backtime=now() where booknum = :id")
    void updateState(@Param("state") String state, @Param("id") Long id);

    List<PBorrow> findAllByUseraccount(String account);





}
